package com.leo.persistence.sqlSession;

import com.leo.persistence.config.XmlConfigBuilder;
import com.leo.persistence.pojo.Configuration;

import java.io.InputStream;

public class SqlSessionFactoryBuilder {

    public SqlSessionFactory build(InputStream in){

        // 1. dom4j解析配置文件, 封装到Configuration
        Configuration configuration = new XmlConfigBuilder().parseConfig(in);

        // 2. 创建SqlSessionFactory
        DefaultSqlSessionFactory defaultSqlSessionFactory = new DefaultSqlSessionFactory(configuration);
        return defaultSqlSessionFactory;
    }

}
